<template>
  <div class="systemannouncement">
    <section class="newaheader">
      <h2 class="title">
        <p>{{$t('gonggao[4]')}}</p>
        <!-- <span>System Bulletin</span> -->
      </h2>
      <!-- <img src="" alt=""> -->
    </section>
    <ul class="newsmain">
      <li v-for="(item, index) in announcementdata.data" :key="index" class="list">
        <router-link :to="{name:'systemannouncementdetails',query:{id: item.id}}" class>
          <h3>{{item.title}}</h3>
          <p>
            <time>{{item.created_at}}</time>
          </p>
        </router-link>
      </li>
    </ul>
    <PagesSize :content="announcementdata" @func="getMsgFormSon"></PagesSize>
  </div>
</template>

<script>
import { systemPosts, news } from '@/api/software';
import PagesSize from "_dom/paging";
export default {
  name: "systemannouncement",
  data() {
    return {
      form: {
        name: "",
        region: ""
      },
      changedata: {
        page: "1"
      },
      announcementdata: [],
      radio1: "",
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        }
      ]
    };
  },
  created() {
    this.announcement("2");
  },
  methods: {
    getMsgFormSon(datavue) {
      this.changedata = datavue;
      if(datavue==this.changedata.page){return}
      this.announcement("2");
    },
    announcement(data) {
      let _data = {
        type: data
      };
      _data.page = this.changedata.page;
      systemPosts(_data)
        .then(res => {
          if (res.data.status_code == 200) {
              console.log(res.data.data)
            this.announcementdata = res.data.data;
          } else {
          }
        })
        .catch(err => {
          this.$message.error(err.msg);
        });
    }
  },
  components: {
    PagesSize
  }
};
</script>

